﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Meeting.Public;

namespace Meeting.Web.Admin.MeetingPre
{
    /// <summary>
    /// MeetingEditOperation 的摘要说明
    /// </summary>
    public class MeetingEditOperation : IHttpHandler
    {
        string methodName = "";
        int nPageIndex = 1;
        int nPageSize = 4;

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json;charset=utf-8";

            nPageIndex = CommonFunction.varToIntDef(context.Request.Params["page"], 1);
            nPageSize = CommonFunction.varToIntDef(context.Request.Params["rows"], 15);
            methodName = context.Request.Params["method"];
            switch (methodName)
            {
                case "GetMeetingById":
                    GetMeetingById(context);
                    break; 
                case "GetCategoryById":
                    GetCategoryById(context);
                    break;
                case "DeleteMeeting":
                    DeleteMeeting(context);
                    break;
                case "GetSelEmployee":
                    GetSelEmployee(context);
                    break;

            }
        }
        //获取会议基本信息 用于修改
        BLL.MeetingExt bll = new BLL.MeetingExt();
        private void GetMeetingById(HttpContext context)
        {
            string meetingId = context.Request["Id"];
            context.Response.Write(bll.GetMeetingById(meetingId));
        }
        private void GetCategoryById(HttpContext context)
        {
            string categoryId = context.Request["Id"];
            context.Response.Write(bll.GetCategoryJson(categoryId));
        }
        private void DeleteMeeting(HttpContext context)
        {
            string meetingId = context.Request["Id"];
            context.Response.Write(bll.DeleteMeeting(meetingId));
        }
        //获取已选择的参会人
        private void GetSelEmployee(HttpContext context)
        {
            string meetingId = context.Request["Id"];
            context.Response.Write(bll.GetSelEmployee(meetingId,""));
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}